package edu.sctu.xiangkun.day201506.day20150626;


import com.alibaba.fastjson.JSON;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;

import java.io.IOException;


/**
 * Created by user04 on 2015/6/26.
 */
public class JsonTest {
//    public static String json;
//
//    public static String getMessage(String url){
//
//        HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
//        CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
//
//        HttpGet httpGet = new HttpGet(url);
//
//        try {
//            HttpResponse httpResponse = closeableHttpClient.execute(httpGet);
//            HttpEntity httpEntity = httpResponse.getEntity();
//            json = EntityUtils.toString(httpEntity);
//
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//
//        return json;
//    }
    public JsonAppbean getJsonAppbean(String json){
        JsonAppbean jsonAppbean = JSON.parseObject(json, JsonAppbean.class);
        return jsonAppbean;
    }
}
